package per.lance.easytomcat.adapter;

import per.lance.easytomcat.handler.DynamicHandler;
import per.lance.easytomcat.net.HttpRequest;
import per.lance.easytomcat.net.HttpRespone;

import java.lang.reflect.InvocationTargetException;

/**
 * @author Lance Li
 * @date 7/9/2018 1:03 PM
 * @desc
 */
public class HttpHandlerAdapter implements HandlerAdapter {

    public boolean supports(Object handler) {
        return (handler instanceof DynamicHandler);
    }

    @Override
    public void handle(Object handler, Object... args) throws IllegalAccessException, InvocationTargetException, ClassNotFoundException {
        boolean flag = ((DynamicHandler) handler).doHttpHandle((HttpRequest) args[0], (HttpRespone) args[1]);
        if (!flag) {
        }
    }
}
